# 公共源文件
set(COMMON_SOURCES
    src/KVStorageClient.cpp
    src/FsStrategy.cpp
)

add_library(kv_storage_client STATIC ${COMMON_SOURCES})

target_include_directories(kv_storage_client PUBLIC
    ${COMMON_DIR}/include
    include
)

if(FS_STRATEGY STREQUAL "THREEFS")
    target_sources(kv_storage_client PRIVATE src/ThreeFsStrategy.cpp)
    target_link_libraries(kv_storage_client PRIVATE
        ${3fs_ROOT}/libhf3fs_api_shared.so
        common_lib
    )
elseif(FS_STRATEGY STREQUAL "POSIX")
    target_sources(kv_storage_client PRIVATE src/PosixStrategy.cpp)
    target_link_libraries(kv_storage_client PRIVATE
        common_lib
    )
elseif(FS_STRATEGY STREQUAL "LUSTRE")
    target_sources(kv_storage_client PRIVATE src/PosixStrategy.cpp)
    target_link_libraries(kv_storage_client PRIVATE
        common_lib
    )
else()
    message(FATAL_ERROR "Unsupported FS_STRATEGY: ${FS_STRATEGY}")
endif()
if(FS_STRATEGY STREQUAL "THREEFS")
    add_compile_definitions(USE_THREEFS)
elseif(FS_STRATEGY STREQUAL "POSIX")
    add_compile_definitions(USE_POSIX)
elseif(FS_STRATEGY STREQUAL "LUSTRE")
    add_compile_definitions(USE_LUSTRE)
endif()